﻿CREATE TABLE [dbo].[Category]
(
	[CategoryId] [int] IDENTITY(1,1) NOT NULL, 
    [CategoryGroupId] [int] NOT NULL,
	[Name] [varchar] (150) NOT NULL,
    [Description] [varchar] (150) NULL,
    [Datecreated] [datetime] NOT NULL,
    [CreatedBy] [varchar] (50) NOT NULL,
    [DateUpdated] [datetime] NOT NULL,
    [UpdatedBy] [varchar] (50) NOT NULL,
    CONSTRAINT [PK_Category] PRIMARY KEY CLUSTERED 
    (
	    [CategoryId] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON)
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[Category]  WITH CHECK ADD  CONSTRAINT [FK_Category_CategoryGroup] FOREIGN KEY([CategoryGroupId])
REFERENCES [dbo].[CategoryGroup] ([CategoryGroupId])
GO

ALTER TABLE [dbo].[Category] CHECK CONSTRAINT [FK_Category_CategoryGroup]
GO